• Resolved qqla

    (@qqla)


    Hello. I’d like you to help me with the four old links. I have to change them for the app to finally work. Please:

    "/wp-json/jwt-auth/v1/token";
    "${WpConfig.websiteUrl} wp-json/jwt-auth/v1/token?Username=$userName&password=$password";
    "/wp-json/wp/v2/users";
    "${WpConfig.websiteUrl}/wp-json/jwt-auth/v1/token?Username=$userName&password=$password"
    • This topic was modified 4 months, 3 weeks ago by Yui.
    • This topic was modified 4 months, 3 weeks ago by Yui. Reason: formatting

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter qqla

    (@qqla)

    I mean a change in the Simple-JWT-Login plugin

    Plugin Author nicu_m

    (@nicu_m)

    Hello @qqla,

    In the plugin, you have autogenerated link example for each route. You can copy the link with just one click.

    Here is the documentation link: https://docs.simplejwtlogin.com/#/?id=screenshot-1

    Best regards,
    Nicu.

    Thread Starter qqla

    (@qqla)

    well. I understand. But could you please give me a link to Bearer $ token. So Authorization and fetchMeUser

    Thread Starter qqla

    (@qqla)

    how to change it: — 1 Future<WpUser> authenticateViaTokenCustom(String? token) async {

    _urlHeader[‘Authorization’] = ‘Bearer $token’;

    final response = await http.post(Uri.parse(WpConfig.websiteUrl + ‘?rest_route=/’), headers: _urlHeader);

    2:Future<WpUser> fetchMeUser(urlHeader) async {
    final response = await http.get(Uri.parse(WpConfig.websiteUrl + ‘/wp-json/wp/v2/users/me’), headers: urlHeader);

    3.`Future<List<Article>?> fetchPostsByCategoryId(int categoryId, int contentAmount) async {
    final int _page = 1;
    List<Article>? _articles;
    var response = await http.get(Uri.parse(
    “${WpConfig.websiteUrl}/wp-json/wp/v2/posts/?categories[]=$categoryId&page=$_page&per_page=$contentAmount&_fields=id,date,title,content,custom,link,tags”));`

    4.Future fetchPostsByCategoryIdExceptPostId(int? postId, int? catId, int contentAmount) async {
    var response = await http.get(Uri.parse(
    “${WpConfig.websiteUrl}/wp-json/wp/v2/posts?exclude=$postId&categories[]=$catId&per_page=$contentAmount”));

    5.Future fetchPopularPosts(int postLimit) async {
    var response = await http.get(Uri.parse(“${WpConfig.websiteUrl}/wp-json/wordpress-popular-posts/v1/popular-posts?limit=$postLimit”));

    6.Future fetchPostsBySearch(String searchText) async {
    var response = await http.get(Uri.parse(“${WpConfig.websiteUrl}/wp-json/wp/v2/posts?search=$searchText”));

    7.Future fetchCommentsById(int? id) async {
    List<CommentModel> _comments = [];
    var response = await http.get(Uri.parse(“${WpConfig.websiteUrl}/wp-json/wp/v2/comments?post=” + id.toString()));

    8.
    Future<bool> postComment(
    int? id, String? name, String email, String comment) async {
    try {
    var response = await http.post(Uri.parse(“${WpConfig.websiteUrl}/wp-json/wp/v2/comments”),

    9.`Future<bool> deleteCommentById (String? _urlHeader, int? id) async {
    final StringBuffer url = new StringBuffer(WpConfig.websiteUrl + ‘/wp-json/wp/v2/comments’ + ‘/$id’);
    HttpClient httpClient = new HttpClient();
    HttpClientRequest request = await httpClient.deleteUrl(Uri.parse(url.toString()));
    request.headers.set(HttpHeaders.contentTypeHeader, “application/json; charset=UTF-8”);`

    9.Future<bool> updateCommentById (String? _urlHeader, int? id, String comment) async {
    final StringBuffer url = new StringBuffer(WpConfig.websiteUrl + ‘/wp-json/wp/v2/comments’ + ‘/$id’);
    HttpClient httpClient = new HttpClient();
    HttpClientRequest request = await httpClient.postUrl(Uri.parse(url.toString()));

    Plugin Author nicu_m

    (@nicu_m)

    Hello @qqla,

    For an authorization example link, just go in simple-jwt-login settings, go to Authorization and there are the generated example links.

    In order to get fetchMe, call the validate endpoint, once you have a valid JWT.

    Hope this helps you.

    PS: Please don’t forget to rate this plugin.

    Best regards,
    Nicu.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.