GET,POST | /auth/{provider} | ||
---|---|---|---|
GET,POST | /auth |
import java.math.*
import java.util.*
import net.servicestack.client.*
/**
* Sign In
*/
@Api(Description="Sign In")
@DataContract
open class Authenticate : IPost, IMeta
{
/**
* AuthProvider, e.g. credentials
*/
@DataMember(Order=1)
var provider:String? = null
@DataMember(Order=2)
var userName:String? = null
@DataMember(Order=3)
var password:String? = null
@DataMember(Order=4)
var rememberMe:Boolean? = null
@DataMember(Order=5)
var accessToken:String? = null
@DataMember(Order=6)
var accessTokenSecret:String? = null
@DataMember(Order=7)
var returnUrl:String? = null
@DataMember(Order=8)
var errorView:String? = null
@DataMember(Order=9)
var meta:HashMap<String,String> = HashMap<String,String>()
}
@DataContract
open class AuthenticateResponse : IMeta, IHasSessionId, IHasBearerToken
{
@DataMember(Order=1)
var userId:String? = null
@DataMember(Order=2)
var sessionId:String? = null
@DataMember(Order=3)
var userName:String? = null
@DataMember(Order=4)
var displayName:String? = null
@DataMember(Order=5)
var referrerUrl:String? = null
@DataMember(Order=6)
var bearerToken:String? = null
@DataMember(Order=7)
var refreshToken:String? = null
@DataMember(Order=8)
var refreshTokenExpiry:Date? = null
@DataMember(Order=9)
var profileUrl:String? = null
@DataMember(Order=10)
var roles:ArrayList<String> = ArrayList<String>()
@DataMember(Order=11)
var permissions:ArrayList<String> = ArrayList<String>()
@DataMember(Order=12)
var responseStatus:ResponseStatus? = null
@DataMember(Order=13)
var meta:HashMap<String,String> = HashMap<String,String>()
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /auth/{provider} HTTP/1.1
Host: vue-vite-api.jamstacks.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"provider":"String","userName":"String","password":"String","rememberMe":false,"accessToken":"String","accessTokenSecret":"String","returnUrl":"String","errorView":"String","meta":{"String":"String"}}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"userId":"String","sessionId":"String","userName":"String","displayName":"String","referrerUrl":"String","bearerToken":"String","refreshToken":"String","refreshTokenExpiry":"\/Date(-62135596800000-0000)\/","profileUrl":"String","roles":["String"],"permissions":["String"],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"meta":{"String":"String"}}