score:1
I don't know if it might help, but I've created a Play 2.x client in Scala and Java which supports OAuth/CAS/OpenID/HTTP authentication and user profile retrieval : https://github.com/leleuj/play-pac4j.
For OAuth support, it's based on Scribe and supports Facebook, Twitter, Google, Yahoo, DropBox, Github, LinkedIn, Windows live, WordPress...
score:4
To answer your specific question, you can get request (query) parameters by calling:
Controller.request().queryString()
Getting OAuth2 is easy but not trivial. It helps to have a working sample. I would recommend downloading Play1, and looking up the sample for Facebook Authentication. And then porting the code over to Play2. I did the above and found the process very instructive. You will realize that each site and API has quirks/needs, so there is very little additional code that seems usable form one site to another.
A more step-by-step answer is that there are several steps. First, you need to get an access_token
and then you can use it. To get an access_token
you need to send the user to the sites authorization url, so far facebook this would be something like:
https://graph.facebook.com/oauth/authorize/?client_id=idFromFacebook&redirect_uri=http://yourdomain.com/auth
Once your user has accepted the authorization, the site will redirect the user with a code, something like http://yourdomain.com/auth?code=XYZ_ABC
. You would then need to request from the sites access token url to get the access token. For Facebook this would be something like:
https://graph.facebook.com/oauth/access_token?client_id=idFromFacebook&client_secret=secredFromFacebook&code=XYZ_ABC&redirect_uri=...
The response from the above url would have the access_token
in it.
Now, you can start using the access token to request information.
Source: stackoverflow.com
Related Query
- How to use OAuth 2 in Play Framework 2.0
- How to use IntelliJ with Play Framework and Scala
- How to force Play framework 2 to always use SSL?
- How do you use play framework as a library, in a scala project
- How to use the Play Framework with Google App Engine with locally installed Java 7?
- How to use sbt-jslint in Play Framework 2.0.x scala?
- How can I use the Play Framework in a multi-project?
- How to use SORM framework with Play Framework?
- In a play framework config (hocon), how do I use an environment variable or a default?
- How do you use DTOs in Play Framework scala templates?
- How to use templates in emails in Play framework 2.0?
- How to use REST client from Play framework without Play
- How to use play framework FakeApplication() for multiple tests?
- How to use my own Iterable in Play Framework template
- How do I use play framework 2's json path to parse json that has been poorly converted from xml?
- How do I use Zookeeper as "Database" with Play Framework instead of traditional JDBC?
- How to use `flatMap` and `map` to fill a `list` on Play framework + Scala?
- How to Use IF Statement in Play Framework to Use CSS for Only 1 Page
- How to use Memcached with the Scala Play Framework 2.2?
- Play framework How to use akka streams output to a websocket
- How to use variable in reusable block in Play Framework 2 (Scala)
- How can I use in java the filtering function of the play framework 2 JsMessages plugin?
- How to use fcm(firebase cloud messaging) with scala play framework to send notification?
- How to use Promise.timeout in play framework filter
- Play Framework 2.4 how to use return statement in Action controller
- How to use cdn url with play framework and scala for image display?
- How do I use a filter to add a domain object to the request scope in Play Framework 2.x
- how to use icon on a button (glyphicons) in play framework
- How to handle optional query parameters in Play framework
- How to integrate Play Framework 2.0 into Gradle build management using Maven dependencies?
More Query from same tag
- Sum up the values of the DataFrame based on conditions
- What is the best way to check the type of a Scala variable?
- java.nio.charset.UnmappableCharacterException: Input length = 1 in Play 2 project after upgrading to sbt-idea 1.5.2
- Difference between position of 'if's in pattern matching
- Using Scala Toolbox eval, how do I define I value I can use in later evals?
- How to generate jar file on Windows terminal compiler?
- Transitive dependencies not being pulled in build.sbt
- Manually exclude some test classes in sbt
- Why to use Applicative
- Messenger for browser and android - Comet, Lift server
- How to get only "p" tags inside "small single" article?
- How to provide parserLib and inferSchema options together for spark-csv
- Scala iterate over two consecutive elements of a list
- How to do default method handling in Scala
- How to convert nested sequences to a sequence of tuples?
- Scala play JSON mapping doesn't work with inheritance
- Reified generics in Scala 2.10
- How to make fully functional immutable classes in Scala?
- Scala: How to interpret foldLeft
- How do I sort a list of maps by a value in the maps? (Scala)
- Extract several parts of a string, inside a string
- Summing up two options
- What is and why is the fault that creates the Illegal cyclic reference error in Scala?
- Why this generic code with enums doesn't compile
- Why does Spark infer a binary instead of an Array[Byte] when creating a DataFrame?
- Does extending a class in scala inherits auxilary constuctor also?
- AbstractMethodError when mixing in trait nested in object - only when compiled and imported
- Understanding companion object in scala
- Pre-test SBT task: Unable to instantiate JDBC driver
- Best way to add and extend a generic writer trait for step by step data storage