Giter VIP home page Giter VIP logo

Comments (3)

p2 avatar p2 commented on August 21, 2024

Can you provide some sample code? You can also try stack overflow.

from oauth2.

Jermms avatar Jermms commented on August 21, 2024
@IBOutlet weak var nextButton: UIButton!
@IBOutlet weak var emailAdd: UITextField!
@IBOutlet weak var password: UITextField!

var oauth2 = OAuth2PasswordGrant(settings: [
    "client_id": "xxxxxxx",                         // yes, this client-id and secret will work!
    "client_secret": "xxxxxxxx",
    "authorize_uri" : "xxxx",
    "username": emailAdd.text,
    "password": "password",
    "verbose": true
    ] as OAuth2JSON)

@IBAction func signInButton(sender: UIButton?) {
    oauth2.authConfig.authorizeEmbedded = false
    signIn(sender)
}

What I am trying to do is to store "username" and "password" to emailAdd.text and password.text
Is it possible?

from oauth2.

p2 avatar p2 commented on August 21, 2024

Ah. username and password are exposed on that instance, so don't try to assign it when you initialize (you can omit "username" and "password" from the settings). Assign it when the user actually wants to authorize, something like:

@IBOutlet weak var emailAdd: UITextField!
@IBOutlet weak var password: UITextField!

var oauth2 = OAuth2PasswordGrant(...)

func signInButton(sender: UIButton?) {
    oauth2.username = emailAdd.text
    oauth2.password = password.text
    oauth2.authConfig.authorizeEmbedded = false
    signIn(sender)
}

from oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.