Is there a sample program in Java of HPW to create header, claim set for JWT (service account ) so that I get the Access token?
The following URL looks close:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount#libraries
But I was looking for any sample program to start with.
Does anyone have any help links?
From http://code.google.com/p/jsontoken/
svn checkout http://jsontoken.googlecode.com/svn/trunk/ jsontoken-read-only
And a fully working example:
https://code.google.com/p/gwdg-java/
JJWT aims to be the easiest to use and understand JWT library for the JVM and Android:
https://github.com/jwtk/jjwt
Related
Is there any way to generate a Token from Flutter application and then validate it?
I tried passing null in Token parameter of AgoraRtcEngine.joinChannel(null, widget.channelName, null, 0); but it is showing black screen for the Audience
Already gone through:
https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart
https://docs.agora.io/en/Real-time-Messaging/token_server_rtm
and other official docs but there's nothing to help in Flutter.
Any help would be appreciated :)
A token needs to be generated using your own server irrespective of the platform you're using. You can have a look at this guide that explains how to build your own server: https://www.agora.io/en/blog/how-to-build-a-token-server-using-golang/
You can have a look at this gist that explains how to use tokens in your Flutter code:
Using tokens - https://gist.github.com/Meherdeep/25d4bdac5dad0c4547809754c9e8417e
Renew tokens - https://gist.github.com/Meherdeep/088c5700f141d27b5e849d466c2358fb
Scenario: Grab the authToken after a login.
Pseudo code | Steps :
Login via UI ( selenium )
grab the authToken via Rest.
Note :
I know how to do this completely via RESTassured or Postman but what would be a good approach to handle this during an automated UI test run.
It's easy to do it manually via Chrome Dev tools but using Java - it's a little bit challenging.
Any help would be nice.
If you have the auth token in the cookie then you can use the below.
# update auth_token below with the correct cookie name
authToken = driver.get_cookie('auth_token')['value']
You can fetch out the token value from the client side. It can be in cookies, local storage or the session storage
Check these value in browser. Open developer tool -- Go to application tab and on the left menu u can find these values for each website
or
Try following js command in the browser console
window.document.cookie
window.localStorage
window.sessionStorage
if u can find your token via any of the above js command , use can use them in selenium.
I have a JavaEE Application. I am trying to implement OAuth.
But I am facing some strange issues:
As per the documentation to manually building the sign in web flow I have to provide a link like this https://www.facebook.com/dialog/oauth?client_id=1231298371123&display=popup&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fc%2Fportal%2Fauth%2Ffacebook_login%3F&scope=email,public_profile,user_birthday&response_type=code%20token which will open the dialog. But the dialog is not opening.
And when the SSO is successful FB is redirecting to the url given above but the problem is FB is appending the query strings like state, code, etc with #. Something like: http://localhost:8080/c/portal/auth/facebook_login?#state=ASDASDASDASD&access_token=EAANXZAlBTi........ Because for this I cannot get the parameters in Java.
Do any one came across this kind of issue.
Please help.
Not sure if I understood the question right but if you want to read the string after # you can use the following code
URI uri = new URI("http://test.com/#something=some");
String fragment = uri.getFragment();
fragment will be everything after #
I am using Magento version 1.9.1.0 and trying to use Magento Rest APIs using OAuth Integration.
I have consumer key and consumer secret. Now want to get OAuth token for Rest APIs usage.
I have followed http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html
In this , we needed oauth_signature and timestamp which we doesn't get when we create consumer on admin panel . Now how can we get OAuth token with only consumer key and consumer secret ?
I think you should follow Inchoo blog http://inchoo.net/magento/consuming-magento-rest-zend_oauth_consumer/. Hope you will get some idea.
The following parameters are required to oauth initiate process :
realm="",
oauth_version="1.0",//oauth version
oauth_signature_method="PLAINTEXT",
oauth_nonce="oklThLFvQkxNUpf",//a random unique value
oauth_timestamp="1426745444", //current time stamp
oauth_consumer_key="37d05fa37aea5513d4cda24c0b1f3e00",//get from admin 'key'
oauth_signature="a183969724b3068b7b0d70e7ce9d0f09%26",//a random unique string
oauth_callback="http%3A%2F%2Flocalhost%3A8888" // your call back method
The initiate url will be like => http://yourdomain/oauth/initiate
I also attached two snap for your help.
please check that .htaccess file rewrite
RewriteRule ^api/rest api.php?type=rest [QSA,L]
takes effect.
Check you use Apache (not nginx or other Webserver that doesn't support .htaccess)
I'm using OpenAM for authentication on my application. I access to my app using such URL:
http://my.company.com/appfolder/appservlet?lang=EN&user=test
On first access, OpenAM agent catches the URL and redirect my browser to the authentication page using this redirection URL:
...openam/UI/Login?goto=http%3A%2F%2Fmy.company.com%3A8080%2Fappfolder
After correct authentication, I'm finally redirected to the following URL:
http://my.company.com/appfolder
This is logic since this is the URL referenced in goto param. But it's not the same than original one: the servlet and custom params (lang and user) are missing.
Any idea how to configure my agent to make it keep servlet and params after redirection ?
take a look at this step of the tutorial "Add Authentication to a Website using OpenAM".
In section "Creating An Access Policy" -> "Wildcard matching" is your answer:
The wildcard * in policy URLs does not match '?'. As such if you
wish to allow GET parameters to be submitted then a second policy for
http://webserver.example.com/*?* is required.
Thanks for your answer. As mentionned in my previous comment, the adding of new policy does not resolve my issue. Actually, I'm not sure to understand how the policies can solve the issue since the goto parameter is generated by the J2EE agent, which acts before policies are applied (as far as I know... I'm maybe wrong).
Anyway, I could solve my problem by re-compiling the J2EE Agent: I've build a new agent.jar based on v3.0.3 available at forgerock. Then I replaced the AmFilterRequestContext.class by a new one, build on source available here:
http://www.docjar.com/html/api/com/sun/identity/agents/filter/AmFilterRequestContext.java.html
With this new agent, my goto is now correct, and redirection works well (and I don't have to define any policy).
The strange thing is that I don't understand why it works now ! I couldn't find any difference between java source mentionned above and uncompiled version of original class! I just added some System.out.println to get variables values and functions results, and built the jar. After restaring my jboss, the goto was correct. I'll try to understand why this finally work now when I've time.